<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\Resource;

class Map extends Resource
{
    public function toArray($request)
    {
        if(method_exists($this, $request->method) && $method = $request->method){
            return $this->$method();
        }
        $this->status = 'failed';
        $this->code = '404';
    }

    public function getItems(){
        return [
            'id'=>$this->id,
            'title'=>$this->title.'（'.$this->widehigh.'）',
            'image'=>env('APP_IMGURL').'/large/'.$this->image,
            'imageoriginal'=>$this->image,
        ];
    }
}
